package gigapaint;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.io.Serializable;

public class MyLine implements Paintable, Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -1285238022747776906L;
	private Point start, end;
	private Color color;
	private int size;

	public MyLine(Point start, Point end, Color color, int size)
	{
		this.start = start;
		this.end = end;
		this.color = color;
		this.size = size;
	}

	@Override
	public void painting(Graphics2D g2d, boolean isDotted)
	{
		BasicStroke b;
		g2d.setPaint(color);
		if (isDotted == true)
		{
			float[] dash = { 8.0f, 3.0f };
			b = new BasicStroke(size, BasicStroke.CAP_BUTT,
					BasicStroke.JOIN_BEVEL, 10.0f, dash, 0.0f); // Zum
																// gestrichelt
																// zeichnen
		} else
		{
			b = new BasicStroke(size);
		}
		g2d.setStroke(b);
		g2d.drawLine(start.x, start.y, end.x, end.y);
	}

	public Point getStart()
	{
		return start;
	}

	public void setStart(Point start)
	{
		this.start = start;
	}

	public Point getEnd()
	{
		return end;
	}

	public void setEnd(Point end)
	{
		this.end = end;
	}

	public Color getColor()
	{
		return color;
	}

	public void setColor(Color color)
	{
		this.color = color;
	}

}
